<template>
  <el-container>
    <el-aside>
      <el-row class="tac">
        <el-col :span="12">
          <el-menu
            default-active="1"
            class="el-menu-vertical-demo"
            @open="handleOpen"
            @close="handleClose"
            style="width:200px"
            router
          >
            <el-menu-item index="/mybuy">
              <template slot="title">
                <i class="el-icon-location"></i>
                <span>我的订单</span>
              </template>
            </el-menu-item>
            <el-menu-item
              index="/mysell"
              style="position:relative"
            >
              <i class="el-icon-menu"></i>
              <el-badge
                :is-dot="dot"
                style="right:88px;position:absolute;top:-8px;"
              >
              </el-badge>
              <span>我的出售</span>
            </el-menu-item>
            <el-menu-item index="/shoucang">
              <i class="el-icon-document"></i>
              <span slot="title">我的收藏</span>
            </el-menu-item>
            <el-menu-item index="/upbaby">
              <i class="el-icon-setting"></i>
              <span slot="title">发布宝贝</span>
            </el-menu-item>
          </el-menu>
        </el-col>
      </el-row>
    </el-aside>
    <el-container>
      <el-main>
        <router-view></router-view>
      </el-main>
    </el-container>
  </el-container>
</template>
<script>
export default {
  data: () => ({
    sell: [],
    dot: false
  }),
  methods: {
    handleOpen(key, keyPath) {
      console.log(key, keyPath)
    },
    handleClose(key, keyPath) {
      console.log(key, keyPath)
    }
  },
  async created() {
    const res = await this.$http.getmysell(this.$store.state.user[0].username)
    this.sell = res.message
    const a = this.sell.some((el) => {
      return el.st === 1
    })
    this.dot = a
  }
}
</script>
<style lang="scss" scoped>
</style>
